﻿<%@ Page Title="Registrar Venta de Acciones" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Venta.aspx.cs" Inherits="Triunfadores.Web.Acciones.Venta" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    
    <div class="box box-primary">
        <div class="box-header with-border">
            <h3 class="box-title">Socio</h3>
            <div class="box-tools pull-right">
                <button title="Collapse" data-toggle="tooltip" data-widget="collapse" class="btn btn-box-tool"><i class="fa fa-minus"></i></button>
            </div>
        </div>
        <div class="box-body">
            <div class="row">
                <div class="col-lg-6">
                    <label>Ingrese el DNI del socio</label>
                    <div class="input-group">
                        <asp:TextBox ID="tbxDni" class="form-control" placeholder="Buscar por DNI" runat="server" MaxLength="8" />
                        <ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender" TargetControlID="tbxDni"
                            FilterType="Numbers" runat="server"></ajaxToolkit:FilteredTextBoxExtender>
                        <span class="input-group-btn">
                            <asp:Button CssClass="btn btn-default" ID="btnBuscarSocio" Text="Buscar" runat="server" Height="34px" OnClick="btnBuscarSocio_Click" />
                        </span>
                    </div>
                    <!-- /input-group -->
                </div>
                <!-- /.col-lg-6 -->
                <div class="col-lg-6">
                    <h4>
                        <asp:Label CssClass="pull-right" Text="" ID="lblFecha" runat="server" /></h4>
                    <br />
                    <asp:UpdatePanel runat="server">
                        <ContentTemplate>
                            <h4>
                                <asp:Label Text="" ID="lblDatosSocio" runat="server" />
                            </h4>
                            <asp:Label CssClass="message-error" Text="" ID="lblMensajeSocio" runat="server" />
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="btnBuscarSocio" EventName="Click" />
                        </Triggers>
                    </asp:UpdatePanel>
                    
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-6">
            <div class="box box-warning">
                <div class="box-header with-border">
                    <h3 class="box-title">Lista de Acciones</h3>
                </div>
                <div class="box-body">
                    <asp:UpdatePanel ID="upAcciones" runat="server">
                        <ContentTemplate>
                            <asp:ListView
                                ID="lvAcciones"
                                ItemType="Triunfadores.BusinessEntities.Accion"
                                runat="server"
                                SelectMethod="ObtenerAcciones" OnItemCommand="lvAcciones_ItemCommand">
                                <EmptyDataTemplate>
                                    <h4 class="message-error" align="center"><strong>No hay elemtos que mostrar.</strong></h4>
                                </EmptyDataTemplate>
                                <LayoutTemplate>
                                    <div class="col-lg-12">
                                        <div class="row" id="itemPlaceholder" runat="server"></div>
                                    </div>
                                </LayoutTemplate>
                                <ItemTemplate>
                                    <div class="col-xs-6 col-lg-4">
                                        <div class="form-group">
                                       <asp:Button ID="btnAgregar"
                                            CssClass="btn btn-success"
                                            CommandName="AddDetalle"
                                            CommandArgument="<%#Item.Id %>"
                                            Text='<%# string.Format("S/. {0}",Eval("Precio"))%>'
                                            runat="server" Font-Bold="True" />
                                        </div>
                                        <!-- Split button -->
                                        <%--<div class="btn-group pull-left">
                                            <button type="button" class="btn btn-success">S/.<%#Item.Precio %></button>

                                            
                                        </div>--%>
                                    </div>
                                </ItemTemplate>
                            </asp:ListView>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
            </div>
        </div>
        <div class="col-lg-6">
            <div class="box box-success">
                <div class="box-header with-border">
                    <h3 class="box-title">Acciones de la Venta</h3>
                </div>
                <div class="box-body">
                    <asp:UpdatePanel ID="upDetalle" runat="server">
                        <ContentTemplate>
                            <asp:ListView ID="lvDetalle" runat="server" OnItemCommand="lvDetalle_ItemCommand">
                                <EmptyDataTemplate>
                                    <h4 class="message-error" align="center"><strong>No se han agregado acciones a la Venta</strong></h4>
                                </EmptyDataTemplate>
                                <LayoutTemplate>
                                    <div class="table-responsive">
                                        <table class="table table-condensed table-hover table-responsive">
                                            <thead>
                                                <tr>
                                                    <th>Costo Acción</th>
                                                    <th>Cantidad</th>
                                                    <th>Monto</th>
                                                    <th>Acciones</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <tr id="itemPlaceholder" runat="server" />
                                            </tbody>
                                            <tfoot>
                                                <tr>
                                                    <td colspan="3">
                                                        <asp:Button ID="btnActualizarDetalle" CssClass="btn btn-primary"
                                                            Text="Actualizar"
                                                            CommandName="ActualizarDetalle"
                                                            runat="server" />
                                                    </td>
                                                    <td>
                                                        <h3>S/.</h3>
                                                    </td>
                                                    <td>
                                                        <h3>
                                                            <asp:Label ID="lblTotal" runat="server" /></h3>
                                                    </td>
                                                </tr>
                                            </tfoot>
                                        </table>
                                    </div>
                                </LayoutTemplate>
                                <ItemTemplate>
                                    <tr>
                                        <td>S/.&nbsp;<%#Eval("Accion.Precio") %></td>
                                        <td>
                                            <asp:TextBox ID="tbxCantidad" Text="<%# Bind('Cantidad') %>" runat="server" CssClass="form-control" MaxLength="3" />
                                            <ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender" TargetControlID="tbxCantidad"
                                                FilterType="Numbers" runat="server"></ajaxToolkit:FilteredTextBoxExtender>
                                        </td>
                                        <td>S/.&nbsp;<%# Eval("Monto") %></td>
                                        <td>
                                            <asp:Button ID="btnQuitar" CssClass="btn btn-danger btn-sm"
                                                Text="Quitar"
                                                CommandName="QuitarDetalle"
                                                CommandArgument='<%#Eval("AccionId") %>'
                                                runat="server" />
                                        </td>
                                    </tr>
                                </ItemTemplate>
                            </asp:ListView>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
            </div>
        </div>
    </div>
    <div class="box-footer">
        <div class="pull-right">
            <a class="btn btn-default" href="/Default.aspx" onclick='return confirm("¿Esta seguro que desea salir? Los datos se perderan");'>Cancelar</a>
            <asp:Button CssClass="btn btn-primary" ID="btnGuardar" Text="Guardar" runat="server" OnClick="btnGuardar_Click" />
        </div>
    </div>
       
</asp:Content>
